﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LinkCard.Model;
using LinkCard.Dao;
using LinkCard.AdminCP.Common;
using System.Data;
namespace LinkCard.AdminCP.Company
{
    public partial class company_new : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Session["USER"] == null) { Response.Redirect("/login.aspx"); }
            //else
            //{
            //    if (hash1way.CheckPermission(hash1way.GetPermission(Session["USER"].ToString()), "SYSADMIN") == false)
            //    {
            //        if (hash1way.CheckPermission(hash1way.GetPermission(Session["USER"].ToString()), "HOMEPAGE") == false)
            //        {
            //            Response.Redirect("/message_box.aspx?why=1&msg=5");
            //        }
            //    }
            //}

            if (!Page.IsPostBack)
            {
                
            }

        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {
            add();
            Response.Redirect("/Company/company_all_published.aspx");
        }

        protected void add()
        {
            string sLogo = LogoFilePath.Value;
            string sCompanyName = CompanyName.Value;
            string sCompanyDetail = CompanyDetail.Value;

            string sSQL = "Insert Company values (N'"+sCompanyName+"',N'"+sCompanyDetail+"','"+sLogo+"')";
            DataHelper.ExecuteNonQuery(sSQL,true);

        }

        
    }
}
